using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Administration_Toolkit_v2
{
    public partial class ImportMasterResxFiles : Form
    {
        public ImportMasterResxFiles()
        {
            InitializeComponent();
        }

        private void btnClose_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void ImportMasterResxFiles_Load(object sender, EventArgs e)
        {
            cmbApplications.DataSource = Utilities.GetApplicationList();
            cmbApplications.ValueMember = "ApplicationID";
            cmbApplications.DisplayMember = "ApplicationName"; 
            
        }

        private void btnImport_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtDirectory.Text == null || txtDirectory.Text == String.Empty)
                {
                    txtStatus.Text = "Please Select a Directory";
                }
                else
                {
                    Utilities.ImportMasterResxFiles(cmbApplications.Text, txtDirectory.Text);
                    txtStatus.Text = "Files Imported";
                }
            }
            catch (Exception ex)
            {
                txtStatus.Text = ex.Message;
            }
        }

        private void btnSelectDirectory_Click(object sender, EventArgs e)
        {
            folderBrowserDialog1.ShowDialog();
            txtDirectory.Text = folderBrowserDialog1.SelectedPath;  
        }
    }
}